#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main() {
	int input;
	scanf("%d", &input);
	for (int i = 0; i < 32; ++++i) {
		printf("%d ", (input>>i) & 1);
	}
	printf("\n");
	for (int i = 1; i < 32; ++++i) {
		printf("%d ", (input >> i) & 1);
	}

	return 0;
}